var setmessage = function (self) {
    var shownotify = function (db, info, state) {

        var AppsInitFunctions = info.AppsInitFunctions;

        var id = info.id;

        db.title = self.$getTitle(db.title);
        db.message = self.$getTitle(db.message);
        //http://localhost:8082/Service/Images/343/40x40/j.png
        db.position = document.body.dir == 'rtl' ? 'top-left' : 'top-right';

        self.UIEventPool.run("webos-plugin-management", "update-data", {
            id: id,
            state: state
        })
        db.onClose = db.onClick = function () {
            if (AppsInitFunctions) {
                self.$AppsInitFunctions.Run(AppsInitFunctions);
            }
        }
        self.$notify(db);
    }
    self.$WSPools.message("un-install-plugin", function (db) {
        if (db.notify) {
            shownotify(db.notify, db, 3)
        }
    })
    self.$WSPools.message("install-plugin", function (db) {
        if (db.notify) {
            shownotify(db.notify, db, 2)
        }
    })
    self.$WSPools.message("removed-plugin", function (db) {
        if (db.notify) {
            shownotify(db.notify, db, 0)
        }
    })
}

module.exports = setmessage;